package com.grf.hadoop.order_grouping;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class OrderReducer extends Reducer<OrderBean, NullWritable, OrderBean, NullWritable> {
    @Override
    protected void reduce(OrderBean key, Iterable<NullWritable> values, Context context)
            throws IOException, InterruptedException {

        int i = 0;
        for (NullWritable value : values) {

            if (i==2) {
                break;
            } else {
                context.write(key,NullWritable.get().get());
                i++;
            }

        }
    }
}
